package com.demo.query;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;

@Data
@NoArgsConstructor
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@ApiModel(value="PageQuery", description="PageQuery")
public class PageQuery {
    // @ApiModelProperty(value = "开始下标")
    private Integer startIndex = 0;
    @ApiModelProperty(value = "当前页")
    private Integer currentPage = 0;
    @ApiModelProperty(value = "页大小")
    private Integer pageSize = 0;

    public void setCurrentPage(Integer currentPage) {
        this.currentPage = currentPage;
        startIndex = (currentPage - 1) * pageSize;
    }

    public void setPageSize(Integer pageSize) {
        this.pageSize = pageSize;
        startIndex = (currentPage - 1) * pageSize;
    }
}
